local ads__shangui = fk.CreateSkill{
  name = "ads__shangui",
}

ads__shangui:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(ads__shangui.name) and player.phase == Player.Finish
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    while true do
      local judge = {
        who = player,
        reason = ads__shangui.name,
        pattern = ".|.|red",
      }
      room:judge(judge)
      if judge.card.color == Card.Red then
        room:obtainCard(player, judge.card, false, fk.ReasonJustMove, nil, ads__shangui.name)
      end
      if player.dead or judge.card.color ~= Card.Red or not room:askToSkillInvoke(player, { skill_name = ads__shangui.name }) then
        break
      end
    end
  end,
})


Fk:loadTranslationTable{
  ["$ads__shangui1"] = "髣髴兮若轻云之蔽月。",
  ["$ads__shangui2"] = "飘飖兮若流风之回雪。",
  ["ads__shangui"] = "山鬼",
  [":ads__shangui"] = "结束阶段开始时，你可以进行判定：若结果为红色，你获得之，然后你可以重复此流程。",
  ["#ads__shangui_obtain"] = "山鬼",
}


ads__shangui:addAI({
  think_skill_invoke = Util.TrueFunc,
})

return ads__shangui
